package STACK;

import java.util.Stack;

public class Test {
    public static void main1(String[] args) {
        Stack<Integer> stack = new Stack<>();
        stack.push(12);//push入栈
        stack.push(23);
        stack.push(34);
        stack.push(45);

        //pop出栈
        int x = stack.pop();
        System.out.println(x);

        //peek获取栈顶元素，但不删除
        int y = stack.peek();
        System.out.println(y);
    }

    public static void main(String[] args) {
        MyStack myStack = new MyStack();
        myStack.push(1);
        myStack.push(2);
        myStack.push(3);
//        System.out.println(myStack.pop());
        System.out.println(myStack.peek());
    }
}
